<template>
  <div class="container">
    <h3 style="text-align:center;">功能区信息添加</h3>
    <hr />
    <div id="area_ruleForm" style="margin:auto;text-align:center;width:80%">
      <el-form
        :model="area_ruleForm"
        status-icon
        :rules="rules"
        ref="area_ruleForm"
        inline-message
        class="demo-ruleForm"
      >
        <el-form-item prop="name">
          <span>功能区名称：</span>
          <el-input v-model="area_ruleForm.name"></el-input>
        </el-form-item>
        <el-form-item prop="english_name">
          <span>功能区英文名称：</span>
          <el-input v-model="area_ruleForm.english_name"></el-input>
        </el-form-item>
        <el-form-item prop="telephone">
          <span>电话：</span>
          <el-input v-model="area_ruleForm.telephone"></el-input>
        </el-form-item>
        <el-form-item prop="discription">
          <span>描述：</span>
          <el-input v-model="area_ruleForm.discription"></el-input>
        </el-form-item>
        <el-form-item>
          <span style="width:80%;text-align:center;">
            <el-button type="primary" @click="submitForm('area_ruleForm')">提交</el-button>
            <el-button type="primary" @click="resetForm('area_ruleForm')">重置</el-button>
            <!-- <el-button type="primary" @click="back">返回</el-button> -->
          </span>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
export default {
  name: "Add",
  data() {
    return {
      area_ruleForm: {
        school_id: "", //学校编号
        compus_id: "", //校区编号
        name: "", //功能区名称
        english_name: "", //英文名称
        telephone: "", //电话
        discription: "", //描述
        create_time: "", //创建时间
        by_who: "" //创建者id
      },
      rules: {
        name: [
          { required: true, message: "请输入功能区名称", trigger: "blur" }
        ],
        english_name: [
          { required: true, message: "请输入功能区英文名称", trigger: "blur" }
        ],
        telephone: [
          {
            required: true,
            message: "请输入功能区办公电话号码",
            trigger: "blur"
          }
        ],
        discription: [
          { required: true, message: "请输入功能区描述", trigger: "blur" }
        ]
      }
    };
  },
  methods: {
    //添加功能区提交
    submitForm(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          alert("submit!");
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },

    //表单重置
    resetForm(formName) {
      this.$refs[formName].resetFields();
    }
  }
};
</script>

<style scoped>
#container {
  width: 80%;
  margin: auto;
  font-size: 20px;
}
span {
  display: inline-block;
  width: 200px;
  font-size: 20px;
  text-align: right;
}
</style>
<style>
#area_ruleForm .el-form-item {
  /* display: inline-block;
  text-align: center; */
  height: 50px;
  line-height: 50px;
}
#area_ruleForm .el-form-item .el-input {
  width: 400px;
  text-align: left;
  height: 50px;
  line-height: 50px;
}
</style>
